<%--
  Created by IntelliJ IDEA.
  User: 王德明
  Date: 2018/4/23
  Time: 10:45
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<div class="modal-header">
    <button class="close" ng-click="cancel()">
        <span aria-hidden="true">×</span>
    </button>
    <h3 class="modal-title" id="modal-title">风控拒绝管理</h3>
</div>
<div class="modal-body" id="modal-body">
    <div class="ibox-content no-borders tab-content">
        <!--添加-->
        <form  name="myForm" class="form-horizontal formTopSpacing" ng-model="addriskrefused" ng-show="type == 0">
            <!-- 类型-->
            <div class="form-group">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span class="text-danger">*</span>类型：</label>
                <div class="col-sm-8">
                    <select name="type" class="form-control" ng-model="addriskrefused.refType" ng-blur="typeBlur($event,addriskrefused.refType)" required>
                        <option value=""></option>
                        <option value="0">通用</option>
                        <option value="1">收单机构</option>
                        <option value="2">商户</option>
                        <option value="3">域名</option>
                    </select>
                </div>
            </div>
            <!-- 名称-->
            <div class="form-group" ng-show="addriskrefused.refType != '0' && addriskrefused.refType != '1' && addriskrefused.refType != '2' && addriskrefused.refType != '3'">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span
                        class="text-danger">*</span>名称：</label>
                <div class="col-sm-8">
                    <select name="name" class="form-control" ng-model="addriskrefused.refId"
                            ng-blur="nameBlur($event,addriskrefused.refId)" required>
                        <option  ng-value=""></option>
                    </select>
                </div>
            </div>
            <div class="form-group" ng-show="addriskrefused.refType == '0'">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span
                        class="text-danger">*</span>名称：</label>
                <div class="col-sm-8">
                    <select name="name" class="form-control" ng-model="addriskrefused.refId" ng-blur="nameBlur($event,addriskrefused.refId)" required>
                        <option ng-value="0">通用</option>
                    </select>
                </div>
            </div>
            <div class="form-group" ng-show="addriskrefused.refType == '1'">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span
                        class="text-danger">*</span>名称：</label>
                <div class="col-sm-8">
                    <select  name="name" class="form-control" ng-model="addriskrefused.refId"
                             ng-blur="nameBlur($event,addriskrefused.refId)" required>
                        <option  ng-repeat="x in init.acquirer" ng-value="x.id">
                            {{ x.name }}
                        </option>
                    </select>
                </div>
            </div>
            <div class="form-group" ng-show="addriskrefused.refType == '2'">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span
                        class="text-danger">*</span>名称：</label>
                <div class="col-sm-8">
                    <select name="name" class="form-control" ng-model="addriskrefused.refId"
                            ng-blur="nameBlur($event,addriskrefused.refId)" required>
                        <option  ng-repeat="x in init.merchant" ng-value="x.id">
                            ({{ x.id }}) {{ x.name }}
                        </option>
                    </select>
                </div>
            </div>
            <div class="form-group" ng-show="addriskrefused.refType == '3'">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span
                        class="text-danger">*</span>名称：</label>
                <div class="col-sm-8">
                    <select name="name" class="form-control" ng-model="addriskrefused.refId"
                            ng-blur="nameBlur($event,addriskrefused.refId)" required>
                        <option ng-repeat="x in init.siteurl" ng-value="x.id">
                            {{ x.siteUrl }}
                        </option>
                    </select>
                </div>
            </div>
            <!-- 拒绝元素-->
            <div class="form-group">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span class="text-danger">*</span>拒绝元素：</label>
                <div class="col-sm-8">
                    <select  name="refusedelement" class="form-control" ng-model="addriskrefused.element" ng-blur="refusedelementBlur($event,addriskrefused.element)" required>
                        <option value=""></option>
                        <option value="sys00000000102000001">发卡行</option>
                        <option value="sys00000000102000002">商务卡</option>
                        <option value="sys00000000102000003">国家</option>
                        <option value="sys00000000180000262">IP</option>
                        <option value="sys00000000180000263">邮箱</option>
                        <option value="sys00000000180000264">卡号</option>
                    </select>
                </div>
            </div>
            <!-- 元素键值-->
            <div class="form-group">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span class="text-danger">*</span>元素键值</label>
                <div class="col-sm-8">
                    <select  name="elementTypeone" class="form-control" ng-model="addriskrefused.elementValue" ng-show="initRefusedParam !=''" ng-blur="elementTypeoneBlur($event,addriskrefused.elementValue)" required>
                        <option value=""></option>
                        <option ng-repeat="x in initRefusedParam" value="{{ x.firstValue !=undefined ? x.firstValue : x.name }}">
                            {{ x.name }}
                        </option>
                    </select>
                    <input  name="elementTypeone" class="form-control" ng-model="addriskrefused.elementValue" ng-show="initRefusedParam == ''" ng-blur="elementTypeoneBlur($event,addriskrefused.elementValue)" required/>
                </div>
            </div>
            <!-- 状态 -->
            <div class="form-group">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span
                        class="text-danger">*</span>状态：</label>
                <div class="col-sm-8">
                    <select name="status" class="form-control" ng-model="addriskrefused.status" ng-blur="statusBlur($event,addriskrefused.status)" required>
                        <option value=""></option>
                        <option value="1">启用</option>
                        <option value="0">禁用</option>
                    </select>
                </div>
            </div>
            <!-- 备注-->
            <div class="form-group">
                <label class="col-sm-3 control-label formTextVerticalMiddle">备注：</label>
                <div class="col-sm-8">
                    <input  class="form-control" ng-model="addriskrefused.remark">
                </div>
            </div>
        </form>
        <!--更新-->
        <form  name="myFormupdate" class="form-horizontal formTopSpacing" ng-model="risk" ng-show="type == 1">
            <!-- 类型-->
            <div class="form-group">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span class="text-danger">*</span>类型：</label>
                <div class="col-sm-8">
                    <select  name="typeupdate" class="form-control" ng-model="risk.refType" ng-blur="typeupdateFocus($event,risk.refType)" required>
                        <option value="" ></option>
                        <option value="0">通用</option>
                        <option value="1">收单机构</option>
                        <option value="2">商户</option>
                        <option value="3">域名</option>
                    </select>
                </div>
            </div>
            <!-- 名称-->
            <div class="form-group">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span class="text-danger">*</span>名称：</label>
                <div class="col-sm-8">
                    <select  name="nameupdate" class="form-control" ng-model="risk.refId" ng-blur="nameupdateFocus($event,risk.refId)" required>
                        <option ng-repeat="x in initParam" value="{{ x.id }}">
                            {{ x.name !=undefined ? x.name : x.siteUrl }}
                        </option>
                    </select>
                </div>
            </div>
            <!-- 拒绝元素-->
            <div class="form-group">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span class="text-danger">*</span>拒绝元素：</label>
                <div class="col-sm-8">
                    <select  name="refusedelementupdate" class="form-control" ng-model="risk.element" ng-blur="refusedelementFocus($event,risk.element)" required>
                        <option value=""></option>
                        <option value="sys00000000102000001">发卡行</option>
                        <option value="sys00000000102000002">商务卡</option>
                        <option value="sys00000000102000003">国家</option>
                        <option value="sys00000000180000262">IP</option>
                        <option value="sys00000000180000263">邮箱</option>
                        <option value="sys00000000180000264">卡号</option>
                    </select>
                </div>
            </div>
            <!-- 元素键值-->
            <div class="form-group">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span
                        class="text-danger">*</span>元素键值：</label>
                <div class="col-sm-8">
                    <select  name="elementkey" class="form-control" ng-model="risk.elementValue" ng-show="initRefusedParam !='' " ng-blur="elementupdateBlur($event,risk.elementValue)"  style="overflow: hidden" required>
                        <option  ng-repeat="x in initRefusedParam" value="{{ x.firstValue !=undefined ? x.firstValue : x.name }}">
                            {{ x.name }}
                        </option>
                    </select>
                    <input name="elementkey" class="form-control" ng-model="risk.elementValue" ng-show="initRefusedParam == ''" ng-blur="elementupdateBlur($event,risk.elementValue)" required/>
                </div>
            </div>
            <!-- 状态 -->
            <div class="form-group">
                <label class="col-sm-3 control-label formTextVerticalMiddle"><span
                        class="text-danger">*</span>状态：</label>
                <div class="col-sm-8">
                    <select name="status" class="form-control" ng-model="risk.status" ng-blur="statusupdateBlur($event,risk.status)" required>
                        <option value=""></option>
                        <option value="1">启用</option>
                        <option value="0">禁用</option>
                    </select>
                </div>
            </div>
            <!-- 备注-->
            <div class="form-group">
                <label class="col-sm-3 control-label formTextVerticalMiddle">备注：</label>
                <div class="col-sm-8">
                    <input class="form-control" ng-model="risk.remark">
                </div>
            </div>

        </form>
    </div>
</div>

<div class="modal-footer">
    <row>
        <div class="col-sm-12">
            <div class="center">
                <button class="btn btn-sm btn-primary general-btn" type="button"
                        ng-click="insertRiskRefuse(addriskrefused,0)"
                        ng-disabled="!myForm.type.$valid || !myForm.name.$valid || !myForm.refusedelement.$valid || !myForm.elementTypeone.$valid || !myForm.status.$valid"
                        ng-show="type == 0">
                    确定
                </button>
                <button class="btn btn-sm btn-primary general-btn" type="button" ng-click="updateRiskRefuse(risk,1)"
                        ng-disabled="nextDisabled(myFormupdate)"
                        ng-show="type == 1">
                    确定
                </button>
            </div>
        </div>
    </row>
</div>
